import wx.aui as aui
import wx
import os



class Mbook(aui.AuiNotebook):
    def __init__(self, parent, **k):
        aui.AuiNotebook.__init__(self, parent, **k)
        #print(parent.GetMenuBar())
        self.parent = parent
        self.count = 0 
        self.FileDrop = None
        self.Bind(wx.EVT_MOUSEWHEEL, self.on_mouse)

    def on_mouse(self, eve):
        select = self.GetSelection()
        if eve.GetWheelRotation() > 0:
            if select < self.count-1:
                self.SetSelection(select+1)
        else:
            if select > 0:
                self.SetSelection(select-1)
        eve.Skip()

    def on_deleteAll(self):
        while self.count:
            self.DeletePage(self.GetSelection())
            self.count -= 1

    def mAddPage(self, obj, name):
        self.AddPage(obj, name, select=True) #, bitmap=images.LB12.GetBitmap())
        self.count += 1


